<!DOCTYPE html>


<html lang="zh-CN">


<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    我把 Python 的 200个标准库整理出来了.md |  
  </title>
  <meta name="generator" content="hexo-theme-ayer">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/dist/main.css">

  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">

  
<link rel="stylesheet" href="/css/custom.css">

  
  
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

  
  

  

</head>

</html>

<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-tips/我把 Python 的 200个标准库整理出来了"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  我把 Python 的 200个标准库整理出来了.md
</h1>
 

    </header>
     
    <div class="article-meta">
      <a href="/2020/11/11/tips/%E6%88%91%E6%8A%8A%20Python%20%E7%9A%84%20200%E4%B8%AA%E6%A0%87%E5%87%86%E5%BA%93%E6%95%B4%E7%90%86%E5%87%BA%E6%9D%A5%E4%BA%86/" class="article-date">
  <time datetime="2020-11-10T16:00:00.000Z" itemprop="datePublished">2020-11-11</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/tips/">tips</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.9k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">7 分钟</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <h2 id="文本"><a href="#文本" class="headerlink" title="文本"></a>文本</h2><p>string：通用字符串操作</p>
<p>re：正则表达式操作</p>
<p>difflib：差异计算工具</p>
<p>textwrap：文本填充</p>
<p>unicodedata：Unicode字符数据库</p>
<p>stringprep：互联网字符串准备工具</p>
<p>readline：GNU按行读取接口</p>
<p>rlcompleter：GNU按行读取的实现函数</p>
<p>struct：将字节解析为打包的二进制数据</p>
<p>codecs：注册表与基类的编解码器</p>
<h2 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h2><p>datetime：基于日期与时间工具</p>
<p>calendar：通用月份函数</p>
<p>collections：容器数据类型</p>
<p>collections.abc：容器虚基类</p>
<p>heapq：堆队列算法</p>
<p>bisect：数组二分算法</p>
<p>array：高效数值数组</p>
<p>weakref：弱引用</p>
<p>types：内置类型的动态创建与命名</p>
<p>copy：浅拷贝与深拷贝</p>
<p>reprlib：交替repr()的实现</p>
<h2 id="数学"><a href="#数学" class="headerlink" title="数学"></a>数学</h2><p>numbers：数值的虚基类</p>
<p>math：数学函数</p>
<p>cmath：复数的数学函数</p>
<p>decimal：定点数与浮点数计算</p>
<p>fractions：有理数</p>
<p>random：生成伪随机数</p>
<h2 id="函数式编程"><a href="#函数式编程" class="headerlink" title="函数式编程"></a>函数式编程</h2><p>itertools：为高效循环生成迭代器</p>
<p>functools：可调用对象上的高阶函数与操作</p>
<p>operator：针对函数的标准操作</p>
<h2 id="文件与目录"><a href="#文件与目录" class="headerlink" title="文件与目录"></a>文件与目录</h2><p>os.path：通用路径名控制</p>
<p>fileinput：从多输入流中遍历行</p>
<p>stat：解释stat()的结果</p>
<p>filecmp：文件与目录的比较函数</p>
<p>tempfile：生成临时文件与目录</p>
<p>glob：Unix风格路径名格式的扩展</p>
<p>fnmatch：Unix风格路径名格式的比对</p>
<p>linecache：文本行的随机存储</p>
<p>shutil：高级文件操作</p>
<p>macpath：MacOS 9路径控制函数</p>
<h2 id="持久化"><a href="#持久化" class="headerlink" title="持久化"></a>持久化</h2><p>pickle：Python对象序列化</p>
<p>copyreg：注册机对pickle的支持函数</p>
<p>shelve：Python对象持久化</p>
<p>marshal：内部Python对象序列化</p>
<p>dbm：Unix“数据库”接口</p>
<p>sqlite3：针对SQLite数据库的API2.0</p>
<h2 id="压缩"><a href="#压缩" class="headerlink" title="压缩"></a>压缩</h2><p>zlib：兼容gzip的压缩</p>
<p>gzip：对gzip文件的支持</p>
<p>bz2：对bzip2压缩的支持</p>
<p>lzma：使用LZMA算法的压缩</p>
<p>zipfile：操作ZIP存档</p>
<p>tarfile：读写tar存档文件</p>
<h2 id="加密"><a href="#加密" class="headerlink" title="加密"></a>加密</h2><p>hashlib：安全散列与消息摘要</p>
<p>hmac：针对消息认证的键散列</p>
<h2 id="操作系统工具"><a href="#操作系统工具" class="headerlink" title="操作系统工具"></a>操作系统工具</h2><p>os：多方面的操作系统接口</p>
<p>io：流核心工具</p>
<p>time：时间的查询与转化</p>
<p>argparser：命令行选项、参数和子命令的解析器</p>
<p>optparser：命令行选项解析器</p>
<p>getopt：C风格的命令行选项解析器</p>
<p>logging：Python日志工具</p>
<p>logging.config：日志配置</p>
<p>logging.handlers：日志处理器</p>
<p>getpass：简易密码输入</p>
<p>curses：字符显示的终端处理</p>
<p>curses.textpad：curses程序的文本输入域</p>
<p>curses.ascii：ASCII字符集工具</p>
<p>curses.panel：curses的控件栈扩展</p>
<p>platform：访问底层平台认证数据</p>
<p>errno：标准错误记号</p>
<p>ctypes：Python外部函数库</p>
<h2 id="并发"><a href="#并发" class="headerlink" title="并发"></a>并发</h2><p>threading：基于线程的并行</p>
<p>multiprocessing：基于进程的并行</p>
<p>concurrent：并发包</p>
<p>concurrent.futures：启动并行任务</p>
<p>subprocess：子进程管理</p>
<p>sched：事件调度</p>
<p>queue：同步队列</p>
<p>select：等待I / O完成</p>
<p>dummy_threading：threading模块的替代（当_thread不可用时）</p>
<p>_thread：底层的线程API（threading基于其上）</p>
<p>_dummy_thread：_thread模块的替代（当_thread不可用时）</p>
<h2 id="进程间通信"><a href="#进程间通信" class="headerlink" title="进程间通信"></a>进程间通信</h2><p>socket：底层网络接口</p>
<p>ssl：socket对象的TLS / SSL填充器</p>
<p>asyncore：异步套接字处理器</p>
<p>asynchat：异步套接字命令 / 响应处理器</p>
<p>signal：异步事务信号处理器</p>
<p>mmap：内存映射文件支持</p>
<h2 id="互联网"><a href="#互联网" class="headerlink" title="互联网"></a>互联网</h2><p>email：邮件与MIME处理包</p>
<p>json：JSON编码与解码</p>
<p>mailcap：mailcap文件处理</p>
<p>mailbox：多种格式控制邮箱</p>
<p>mimetypes：文件名与MIME类型映射</p>
<p>base64：RFC3548：Base16、Base32、Base64编码</p>
<p>binhex：binhex4文件编码与解码</p>
<p>binascii：二进制码与ASCII码间的转化</p>
<p>quopri：MIMEquoted - printable数据的编码与解码</p>
<p>uu：uuencode文件的编码与解码</p>
<h2 id="互联网协议与支持"><a href="#互联网协议与支持" class="headerlink" title="互联网协议与支持"></a>互联网协议与支持</h2><p>webbrowser：简易Web浏览器控制器</p>
<p>cgi：CGI支持</p>
<p>cgitb：CGI脚本反向追踪管理器</p>
<p>wsgiref：WSGI工具与引用实现</p>
<p>urllib：URL处理模块</p>
<p>urllib.request：打开URL连接的扩展库</p>
<p>urllib.response：urllib模块的响应类</p>
<p>urllib.parse：将URL解析成组件</p>
<p>urllib.error：urllib.request引发的异常类</p>
<p>urllib.robotparser：robots.txt的解析器</p>
<p>http：HTTP模块</p>
<p>http.client：HTTP协议客户端</p>
<p>ftplib：FTP协议客户端</p>
<p>poplib：POP协议客户端</p>
<p>imaplib：IMAP4协议客户端</p>
<p>nntplib：NNTP协议客户端</p>
<p>smtplib：SMTP协议客户端</p>
<p>smtpd：SMTP服务器</p>
<p>telnetlib：Telnet客户端</p>
<p>uuid：RFC4122的UUID对象</p>
<p>socketserver：网络服务器框架</p>
<p>http.server：HTTP服务器</p>
<p>http.cookies：HTTPCookie状态管理器</p>
<p>http.cookiejar：HTTP客户端的Cookie处理</p>
<p>xmlrpc：XML - RPC服务器和客户端模块</p>
<p>xmlrpc.client：XML - RPC客户端访问</p>
<p>xmlrpc.server：XML - RPC服务器基础</p>
<p>ipaddress：IPv4 / IPv6控制库</p>
<h2 id="多媒体"><a href="#多媒体" class="headerlink" title="多媒体"></a>多媒体</h2><p>audioop：处理原始音频数据</p>
<p>aifc：读写AIFF和AIFC文件</p>
<p>sunau：读写Sun AU文件</p>
<p>wave：读写WAV文件</p>
<p>chunk：读取IFF大文件</p>
<p>colorsys：颜色系统间转化</p>
<p>imghdr：指定图像类型</p>
<p>sndhdr：指定声音文件类型</p>
<p>ossaudiodev：访问兼容OSS的音频设备</p>
<h2 id="国际化"><a href="#国际化" class="headerlink" title="国际化"></a>国际化</h2><p>gettext：多语言的国际化服务</p>
<p>locale：国际化服务</p>
<h2 id="编程框架"><a href="#编程框架" class="headerlink" title="编程框架"></a>编程框架</h2><p>turtle：Turtle图形库</p>
<p>cmd：基于行的命令解释器支持</p>
<p>shlex：简单词典分析</p>
<h2 id="Tk图形用户接口"><a href="#Tk图形用户接口" class="headerlink" title="Tk图形用户接口"></a>Tk图形用户接口</h2><p>tkinter：Tcl / Tk接口</p>
<p>tkinter.ttk：Tk主题控件</p>
<p>tkinter.tix：Tk扩展控件</p>
<p>tkinter.scrolledtext：滚轴文本控件</p>
<h2 id="开发工具"><a href="#开发工具" class="headerlink" title="开发工具"></a>开发工具</h2><p>pydoc：文档生成器和在线帮助系统</p>
<p>doctest：交互式Python示例</p>
<p>unittest：单元测试框架</p>
<p>unittest.mock：模拟对象库</p>
<p>test：Python回归测试包</p>
<p>test.support：Python测试工具套件</p>
<p>venv：虚拟环境搭建</p>
<h2 id="调试"><a href="#调试" class="headerlink" title="调试"></a>调试</h2><p>bdb：调试框架</p>
<p>faulthandler：Python反向追踪库</p>
<p>pdb：Python调试器</p>
<p>timeit：小段代码执行时间测算</p>
<p>trace：Python执行状态追踪</p>
<h2 id="运行时"><a href="#运行时" class="headerlink" title="运行时"></a>运行时</h2><p>sys：系统相关的参数与函数</p>
<p>sysconfig：访问Python配置信息</p>
<p>builtins：内置对象</p>
<p>main：顶层脚本环境</p>
<p>warnings：警告控制</p>
<p>contextlib：with状态的上下文工具</p>
<p>abc：虚基类</p>
<p>atexit：出口处理器</p>
<p>traceback：打印或读取一条栈的反向追踪</p>
<p>future：未来状态定义</p>
<p>gc：垃圾回收接口</p>
<p>inspect：检查存活的对象</p>
<p>site：址相关的配置钩子（hook）</p>
<p>fpectl：浮点数异常控制</p>
<p>distutils：生成和安装Python模块</p>
<h2 id="解释器"><a href="#解释器" class="headerlink" title="解释器"></a>解释器</h2><p>code：基类解释器</p>
<p>codeop：编译Python代码</p>
<h2 id="导入模块"><a href="#导入模块" class="headerlink" title="导入模块"></a>导入模块</h2><p>imp：访问import模块的内部</p>
<p>zipimport：从ZIP归档中导入模块</p>
<p>pkgutil：包扩展工具</p>
<p>modulefinder：通过脚本查找模块</p>
<p>runpy：定位并执行Python模块</p>
<p>importlib：import的一种实施</p>
<h2 id="Python语言"><a href="#Python语言" class="headerlink" title="Python语言"></a>Python语言</h2><p>parser：访问Python解析树</p>
<p>ast：抽象句法树</p>
<p>symtable：访问编译器符号表</p>
<p>symbol：Python解析树中的常量</p>
<p>token：Python解析树中的常量</p>
<p>keyword：Python关键字测试</p>
<p>tokenize：Python源文件分词</p>
<p>tabnany：模糊缩进检测</p>
<p>pyclbr：Python类浏览支持</p>
<p>py_compile：编译Python源文件</p>
<p>compileall：按字节编译Python库</p>
<p>dis：Python字节码的反汇编器</p>
<p>pickletools：序列化开发工具</p>
<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><p>formatter：通用格式化输出</p>
<h2 id="Windows相关"><a href="#Windows相关" class="headerlink" title="Windows相关"></a>Windows相关</h2><p>msilib：读写Windows的Installer文件</p>
<p>msvcrt：MS VC + + Runtime的有用程序</p>
<p>winreg：Windows注册表访问</p>
<p>winsound：Windows声音播放接口</p>
<h2 id="Unix相关"><a href="#Unix相关" class="headerlink" title="Unix相关"></a>Unix相关</h2><p>posix：最常用的POSIX调用</p>
<p>pwd：密码数据库</p>
<p>spwd：影子密码数据库</p>
<p>grp：组数据库</p>
<p>crypt：Unix密码验证</p>
<p>termios：POSIX风格的tty控制</p>
<p>tty：终端控制函数</p>
<p>pty：伪终端工具</p>
<p>fcntl：系统调用fcntl()和ioctl()</p>
<p>pipes：shell管道接口</p>
<p>resource：资源可用信息</p>
<p>nis：Sun的NIS的接口</p>
<p>syslog：Unix 日志服务</p>
<p>以上就是对Python内置各个模块的简要总结，大家可收藏此文，后面做项目时再从中检索。希望此文能帮助到大家，欢迎补充还常用的Python内置模块。</p>
 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          打赏
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>版权声明： </strong>
          
          本博客所有文章除特别声明外，著作权归作者所有。转载请注明出处！
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2020/11/11/tips/%E6%88%91%E6%8A%8A%20Python%20%E7%9A%84%20200%E4%B8%AA%E6%A0%87%E5%87%86%E5%BA%93%E6%95%B4%E7%90%86%E5%87%BA%E6%9D%A5%E4%BA%86/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tips/" rel="tag">tips</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2020/11/11/tips/%E5%AF%B9%E6%AF%94%E6%B5%8B%E8%AF%847%E5%A4%A7%E5%89%8D%E7%AB%AF%E5%8F%AF%E8%A7%86%E5%8C%96%E5%B8%83%E5%B1%80%E6%8B%96%E6%8B%BD%E7%9A%84%E5%B7%A5%E5%85%B7/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            对比测评7大前端可视化布局拖拽的工具.md
          
        </div>
      </a>
    
    
      <a href="/2020/11/11/tips/%E6%8E%A8%E8%8D%90%E8%BF%9922%E6%AC%BE%E9%AB%98%E9%A2%9C%E5%80%BC%E7%9A%84%E7%BB%88%E7%AB%AF%E5%B7%A5%E5%85%B7/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">推荐这22款高颜值的终端工具.md</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "",
    app_key: "",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
     
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2015-2020
        <i class="ri-heart-fill heart_icon"></i> TzWind
      </li>
    </ul>
    <ul>
      <li>
        
        
        
        由 <a href="https://hexo.io" target="_blank">Hexo</a> 强力驱动
        <span class="division">|</span>
        主题 - <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="Hexo"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" target="_blank" rel="noopener" href="http://www.baidu.com">百度</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友链</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2019/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="搜索">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->


<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>

<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->


<link rel="stylesheet" href="/css/clipboard.css">

<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>


<!-- CanvasBackground -->


    
  </div>
</body>

</html>